Two chains of dollar stores in New York will pay $1.2 million to settle claims from the New York Attorney General’s Office that they sold expired or obsolete products to customers, including medicine and motor oil, and failed to follow the state’s bottle deposit law.

The settlement is the result of an undercover probe by investigators from the Attorney General’s Office, which visited stores owned by Dollar General and Dollar Tree over a two-year period to scope out the misconduct.